﻿#region Header
// ------------------------ Licence / Copyright ------------------------
// 
// ScrumTable for Scrum Meeting Support
// Copyright © HSR - Hochschule für Technik Rapperswil
// All Rights Reserved
// 
// Author:
//  Michael Gfeller Silvan Gehrig Patrick Boos
// 
// ---------------------------------------------------------------------
#endregion

#region Usings

using System.Collections.ObjectModel;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ScrumTable.UI.ViewModel.Extension;

#endregion

namespace ScrumTable.UI.ViewModel.Test
{
    /// <summary>
    /// Tests the ScrumController
    /// </summary>
    [TestClass]
    public class ObservableCollectionExtensionsTest
    {
       

        #region Constructors / Destructor
        //--------------------------------------------------------------------
        // Constructors / Destructor
        //--------------------------------------------------------------------
        
       
        #endregion



       
        #region Methods
        //--------------------------------------------------------------------
        // Methods
        //--------------------------------------------------------------------
        
        [TestMethod]
        public void TestAddItem()
        {
            ObservableCollection<string> left = new ObservableCollection<string>(new [] {"1", "2", "4"});
            ObservableCollection<string> right = new ObservableCollection<string>(new [] { "1", "2","3","4" });
            left.UnionToLeft(right);

            Assert.IsTrue(left.Contains("1"));
            Assert.IsTrue(left.Contains("2"));
            Assert.IsTrue(left.Contains("3"));
            Assert.IsTrue(left.Contains("4"));

        }


        [TestMethod]
        public void TestRemoveItem()
        {
            ObservableCollection<string> left = new ObservableCollection<string>(new [] { "1", "2", "3", "4" });
            ObservableCollection<string> right = new ObservableCollection<string>(new string[] { "2" });
            left.UnionToLeft(right);

            Assert.IsFalse(left.Contains("1"));
            Assert.IsTrue(left.Contains("2"));
            Assert.IsFalse(left.Contains("3"));
            Assert.IsFalse(left.Contains("4"));

        }

        [TestMethod]
        public void TestAll()
        {
            ObservableCollection<string> left = new ObservableCollection<string>(new [] { "1", "2", "4" });

            ObservableCollection<string> right = new ObservableCollection<string>(new [] { "1", "3", "5"});
            left.UnionToLeft(right);

            Assert.IsTrue(left.Contains("1"));
            Assert.IsFalse(left.Contains("2"));
            Assert.IsTrue(left.Contains("3"));
            Assert.IsFalse(left.Contains("4"));
            Assert.IsTrue(left.Contains("5"));

        }


      
        #endregion
    }
}
